import com.adobe.cairngorm.control.CairngormEventDispatcher;

import mx.core.IUIComponent;
import mx.events.DragEvent;

import net.optix.ip.events.DeleteFirmEvent;
import net.optix.ip.model.ModelLocator;
import net.optix.ip.vo.FirmVO;
[Bindable]
private var model:ModelLocator	=	ModelLocator.getInstance();

[Bindable]
private var firm:FirmVO;

private function selectFirm():void
{
	firm	=	FirmVO(firms.selectedItem);
}

public function deleteFirm():void
{
	var event:DeleteFirmEvent	=	new DeleteFirmEvent(firm.firmID);
	CairngormEventDispatcher.getInstance().dispatchEvent(event);
	
}

import mx.managers.DragManager;
import mx.controls.dataGridClasses.DataGridColumn;
import net.optix.ip.events.GetOrderFirmsEvent;

public function updateFirm():void
{
	
}

private function image_dragEnter(evt:DragEvent):void 
{
	var obj:IUIComponent = IUIComponent(evt.currentTarget);
 	DragManager.acceptDragDrop(obj);
}

private function image_dragDrop(evt:DragEvent):void 
{
	model.firms.addItem((evt.dragInitiator as DataGrid).selectedItem);
}

private function showID(object:Object,column:DataGridColumn):String
{
	var index:int	=	model.firms.getItemIndex(object)+1;
	return ""+index;
}

private function initApp():void
{
	var getOrders:GetOrderFirmsEvent	=	new GetOrderFirmsEvent();
	com.adobe.cairngorm.control.CairngormEventDispatcher.getInstance().dispatchEvent(getOrders);
}